Class symantec.itools.multimedia.ScrollingText
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.multimedia.ScrollingText

Object
   |
   +----Component
           |
           +----Canvas
                   |
                   +----symantec.itools.multimedia.ScrollingText

public class ScrollingText
extends Canvas
implements Runnable
Scrolling text component. Forms a text banner that scrolls specified text horizontally. The component allows multiple messages and links.

Version:
1.0, Feb 2, 1997
Author:
Symantec

Variable Index

 o SCROLL_LEFT
Constant which indicates that the banner should scroll from right to left
 o SCROLL_RIGHT
Constant which indicates that the banner should scroll from left to right
 o context
If used in an applet, this is the applet's context.
 o currIndex
Index of current message text and URL
 o currLinkTo
Current URL link.
 o currMessage
Current message text.
 o frame
Location in browser to show linked HTML pages.
 o hiliteColor
Color for highlighted text.
 o isMouseOver
Mouse over message text.
 o lastMouseX
Last mouse cursor position.
 o lastMouseY
Last mouse cursor position.
 o linkToList
URL links which correspond with messages.
 o messageList
List of messages to scroll across the banner.
 o scrollDirection
Current scroll direction.
 o scrollThread
Thread which runs the scrolling animation.
 o scrollUnit
Distance to scroll on each update.
 o sleepTime
Controls the speed of the scroll.
 o suspended
State of scrolling animation.
 o textHeight
Height of current message text.
 o textImage
The offscreen buffer to draw in.
 o textWidth
Width of current message text.
 o textX
Current horizontal text position.
 o textY
Current vertical text position.
 o wasMouseOverText
Status of mouse position.
 o wasStatusMessage
Previous status message.

Constructor Index

 o symantec.itools.multimedia.ScrollingText()
Construct default scrolling text banner.

Method Index

 o addNotify()
Tells this component that it has been added to a container.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all event changes.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable listener for all event changes.
 o createTextParams()
Setup metrics information for current message.
 o getFrame()
Obtain the display location of linked pages.
 o getHiliteColor()
Obtain the current color for text highlighting
 o getLinkToList()
Obtain the current set of URL links.
 o getMessageList()
Obtain the current list of messages.
 o getScrollDirection()
Obtain the current direction of scrolling.
 o getScrollInterval()
Obtain the current scroll interval.
 o getScrollUnit()
Obtain the current size of the scroll step.
 o hide()
Makes this component invisible.
 o isImageInvalid()
Returns true if a image has been set, but it is not the size of this component.
 o isMouseOverText(int, int)
Determines if the given point is over the current text.
 o nextPos()
Increment scroll step.
 o paint(Graphics)
Paints this component using the given graphics context.
 o removeNotify()
Tells this component that it is being removed from a container.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all event changes.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable listener for all event changes.
 o reshape(int, int, int, int)
Moves and/or resizes this component.
 o run()
ScrollingText thread body.
 o setAppletContext(AppletContext)
Specify the current applet context.
 o setFrame(String)
Specify the display location of linked pages.
 o setHiliteColor(Color)
Set the highlight color for text.
 o setLinkToList(URL[])
Specify the list of URLs for message links.
 o setMessageList(String[])
Specify the current list of messages.
 o setScrollDirection(int)
Specify the banner's current scroll direction.
 o setScrollInterval(int)
Set sleep time between scroll steps.
 o setScrollUnit(int)
Specify the size of each scroll step.
 o show()
Makes this component visible.
 o startScrollingText()
Resumes the animation of the scrolling text.
 o stopScrollingText()
Suspends the animation of the scrolling text.
 o update(Graphics)
Handles redrawing of this component on the screen.
 o updateCurrentMessage(boolean)
Move to next message in message list.
 o validate()
Ensures that this component is laid out properly, as needed.

Variables

 o SCROLL_LEFT
public static final int SCROLL_LEFT
Constant which indicates that the banner should scroll from right to left

 o SCROLL_RIGHT
public static final int SCROLL_RIGHT
Constant which indicates that the banner should scroll from left to right

 o context
protected transient java.applet.AppletContext context
If used in an applet, this is the applet's context.

 o currIndex
protected int currIndex
Index of current message text and URL

 o currLinkTo
protected java.net.URL currLinkTo
Current URL link.

 o currMessage
protected java.lang.String currMessage
Current message text.

 o frame
protected java.lang.String frame
Location in browser to show linked HTML pages. Valid values are "_self" to show in the current frame; "_parent" show in the parent frame; "_top" show in the topmost frame; "_blank" show in a new unnamed top-level window; name show in a new top-level window named name.

 o hiliteColor
protected java.awt.Color hiliteColor
Color for highlighted text. Default value is red.

 o isMouseOver
protected transient boolean isMouseOver
Mouse over message text.

 o lastMouseX
protected transient int lastMouseX
Last mouse cursor position.

 o lastMouseY
protected transient int lastMouseY
Last mouse cursor position.

 o linkToList
protected java.net.URL[] linkToList
URL links which correspond with messages.

 o messageList
protected java.lang.String[] messageList
List of messages to scroll across the banner.

 o scrollDirection
protected int scrollDirection
Current scroll direction. Default value SCROLL_LEFT.

 o scrollThread
protected transient java.lang.Thread scrollThread
Thread which runs the scrolling animation.

 o scrollUnit
protected int scrollUnit
Distance to scroll on each update. Distance is in pixels. Default value 10.

 o sleepTime
protected int sleepTime
Controls the speed of the scroll. Default value 150.

 o suspended
protected transient boolean suspended
State of scrolling animation.

 o textHeight
protected transient int textHeight
Height of current message text.

 o textImage
protected transient java.awt.Image textImage
The offscreen buffer to draw in.

 o textWidth
protected transient int textWidth
Width of current message text.

 o textX
protected transient int textX
Current horizontal text position.

 o textY
protected transient int textY
Current vertical text position.

 o wasMouseOverText
protected transient boolean wasMouseOverText
Status of mouse position.

 o wasStatusMessage
protected transient java.lang.String wasStatusMessage
Previous status message.

Constructors

 o ScrollingText
public ScrollingText()
Construct default scrolling text banner.

Methods

 o addNotify
public synchronized void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to start the scrolling text thread.

Overrides:
addNotify in class Canvas
See Also:
removeNotify
 o addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all event changes.

Parameters:
PropertyChangeListener - listener the listener to add.
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable listener for all event changes.

Parameters:
VetoableChangeListener - listener the listener to add.
See Also:
removeVetoableChangeListener
 o createTextParams
protected void createTextParams()
Setup metrics information for current message. Sets textX, textY, textHeight and textWidth.

 o getFrame
public java.lang.String getFrame()
Obtain the display location of linked pages. If the ScrollingText is in an applet this method returns where the linked pages are displayed.

Returns:
Place to display the linked documents. Valid values are "_self" to show in the current frame; "_parent" show in the parent frame; "_top" show in the topmost frame; "_blank" show in a new unnamed top-level window; show in a new top-level window named name
 o getHiliteColor
public java.awt.Color getHiliteColor()
Obtain the current color for text highlighting

Returns:
current highlight color
 o getLinkToList
public java.net.URL[] getLinkToList()
Obtain the current set of URL links.

Returns:
list of URL links. Each URL corresponds to the message of the same index in the message list
 o getMessageList
public java.lang.String[] getMessageList()
Obtain the current list of messages.

Returns:
the current list of messages being displayed
 o getScrollDirection
public int getScrollDirection()
Obtain the current direction of scrolling.

Returns:
the current direction, either SCROLL_LEFT or SCROLL_RIGHT
 o getScrollInterval
public int getScrollInterval()
Obtain the current scroll interval. This is the number of milliseconds that the scroll thread will sleep between scroll steps.

Returns:
current scroll delay setting, in milliseconds
 o getScrollUnit
public int getScrollUnit()
Obtain the current size of the scroll step.

Returns:
the number of pixels that text moves on each scroll step
 o hide
public synchronized void hide()
Makes this component invisible. This is a standard Java AWT method which gets called to hide this component. A hidden component cannot be seen by the user nor does it take up space in its container, but it does continue to exist.

Overrides:
hide in class Component
See Also:
show
 o isImageInvalid
protected boolean isImageInvalid()
Returns true if a image has been set, but it is not the size of this component.

 o isMouseOverText
protected boolean isMouseOverText(int x,
                                  int y)
Determines if the given point is over the current text.

Parameters:
x - horizontal location of point
y - vertical location of point
Returns:
true if given point is over the current text
 o nextPos
protected synchronized void nextPos()
Increment scroll step. Moves to next message as needed. Not usually called directly.

 o paint
public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Canvas
See Also:
repaint, update
 o removeNotify
public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to stop the scrolling text thread.

Overrides:
removeNotify in class Component
See Also:
addNotify
 o removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all event changes.

Parameters:
PropertyChangeListener - listener the listener to remove.
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable listener for all event changes.

Parameters:
VetoableChangeListener - listener the listener to remove.
See Also:
addVetoableChangeListener
 o reshape
public synchronized void reshape(int x,
                                 int y,
                                 int width,
                                 int height)
Moves and/or resizes this component. This is a standard Java AWT method which gets called to move and/or resize this component. Components that are in containers with layout managers should not call this method, but rely on the layout manager instead.

Parameters:
x - horizontal position in the parent's coordinate space
y - vertical position in the parent's coordinate space
width - the new width
height - the new height
Overrides:
reshape in class Component
 o run
public void run()
ScrollingText thread body. This method is called by the Java virtual machine to when this thread starts.

 o setAppletContext
protected void setAppletContext(AppletContext c)
Specify the current applet context.

Parameters:
c - new applet context
 o setFrame
public void setFrame(String newFrame) throws PropertyVetoException
Specify the display location of linked pages. If the ScrollingText is in an applet this method determines where the linked pages are displayed.

Parameters:
newFrame - where to display the linked documents. Valid values are "_self" to show in the current frame; "_parent" show in the parent frame; "_top" show in the topmost frame; "_blank" show in a new unnamed top-level window; show in a new top-level window named name
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setHiliteColor
public void setHiliteColor(Color newHiliteColor) throws PropertyVetoException
Set the highlight color for text. Text is highlighted in this color when the mouse cursor is over it and it contains a non-null link.

Parameters:
newHiliteColor - color for highlighted text.
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setLinkToList
public void setLinkToList(URL[] list) throws PropertyVetoException
Specify the list of URLs for message links. Each link corresponds with a message in the message list. If a message has no link, a null URL should be included for that message.

Parameters:
list - list of URL links
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setMessageList
public void setMessageList(String[] list) throws PropertyVetoException
Specify the current list of messages. These messages scroll sequentially through the banner.

Parameters:
list - list of messages to display
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setScrollDirection
public void setScrollDirection(int dir) throws PropertyVetoException
Specify the banner's current scroll direction.

Parameters:
dir - direction to scroll. Valid values are SCROLL_LEFT and SCROLL_RIGHT
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setScrollInterval
public void setScrollInterval(int speed) throws PropertyVetoException
Set sleep time between scroll steps. This function controls the speed of scrolling. A lower number indicates a faster speed.

Parameters:
speed - number of milliseconds to sleep between scroll steps. The smaller the number the faster the scroll. Minimum value of 30.
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setScrollUnit
public void setScrollUnit(int unit) throws PropertyVetoException
Specify the size of each scroll step.

Parameters:
unit - the number of pixels to move the text on each scroll step
Throws: PropertyVetoException
if the specified property value is unacceptable
 o show
public synchronized void show()
Makes this component visible. This is a standard Java AWT method which gets called to show this component. If this component was invisible due to a previous hide() call it make this component visible again.

Overrides:
show in class Component
See Also:
hide
 o startScrollingText
public void startScrollingText()
Resumes the animation of the scrolling text.

 o stopScrollingText
public void stopScrollingText()
Suspends the animation of the scrolling text.

 o update
public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to reduce flicker by eliminating the uneeded clearing of the background.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint
 o updateCurrentMessage
protected void updateCurrentMessage(boolean next)
Move to next message in message list. Not usually called directly.

Parameters:
next - if true, move to next message; otherwise reset message with current index
 o validate
public void validate()
Ensures that this component is laid out properly, as needed. This is a standard Java AWT method which gets called by the AWT to make sure this component and its subcomponents have a valid layout. If this component was made invalid with a call to invalidate(), then it is laid out again. It is overridden here to also find the containing applet at validation time.

Overrides:
validate in class Component
See Also:
invalidate

All Packages  Class Hierarchy  This Package  Previous  Next  Index